package web;

import java.util.LinkedList;
import java.util.List;

import repository.implementation.DataBaseWorker;
import repository.implementation.RegistrationRepository;

public class ApplicationStart
{
	public static void main(String args[])
	{
		List<String> feed = new LinkedList<String>();
		feed.add("http://allrecipes.com/recipes/appetizers-and-snacks/?soid=showcase_1"); // appetaizer
																							// and
																							// snack
		feed.add("http://allrecipes.com/recipes/breakfast-and-brunch/?soid=showcase_2");
//		// breakfast and brunch
		feed.add("http://allrecipes.com/recipes/meat-and-poultry/chicken/?soid=showcase_3");
//		// chicken
		feed.add("http://allrecipes.com/recipes/desserts/?soid=showcase_4");
		// deserts
		feed.add("http://allrecipes.com/recipes/healthy-recipes/?soid=showcase_5");// healthy
		feed.add("http://allrecipes.com/recipes/main-dish/?soid=showcase_6");// main dish
		feed.add("http://allrecipes.com/Recipes/Pasta/?soid=showcase_7");// pasta
		feed.add("http://allrecipes.com/recipes/salad/?soid=showcase_8");// salad
		feed.add("http://allrecipes.com/Recipes/Everyday-Cooking/Slow-Cooker/?soid=showcase_9"); // slow
																									// cooker
		feed.add("http://allrecipes.com/recipes/everyday-cooking/vegetarian/?soid=showcase_10");// vegetarian

		CrawlerRegistration webRepository = new CrawlerRegistration();
		RegistrationRepository modelRepository = new RegistrationRepository();

		Crawler crawler = new Crawler(feed, webRepository);
		new Thread(crawler).start();

		DataBaseWorker dbWorker = new DataBaseWorker(modelRepository, 2);
		new Thread(dbWorker).start();

		for (int i = 0; i < 10; i++)
		{
			new Thread(new CrawlerWorker(webRepository, modelRepository,
					new DataBaseWorker[] { dbWorker })).start();
		}
		/*
		 * CrawlerWorker worker1 = new CrawlerWorker("unused field",
		 * webRepository, modelRepository); new Thread(worker1).start();
		 * 
		 * CrawlerWorker worker2 = new CrawlerWorker("unused field",
		 * webRepository, modelRepository); // new Thread(worker2).start();
		 */

	}
}
